package com.deep.member.config;


import com.deep.member.annotation.ApiController;
import com.deep.member.model.properties.ApiPathProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * web配置类
 *
 * @author Deep
 * @date 2022/2/4
 */
@Configuration
public class MallWebConfig implements WebMvcConfigurer {

    @Autowired
    private ApiPathProperties apiPathProperties;

    /**
     * 请求路径统一管理
     */
    @Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        configurer
                .addPathPrefix(apiPathProperties.getGlobalPrefix(), c -> c.isAnnotationPresent(ApiController.class));
    }
}

